package prv.pursuivant.util;

import static org.junit.Assert.assertEquals;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

import com.google.inject.Guice;

public class DateUtilTest {

	@Test
	public void shouldParseWowDate() throws ParseException {
		DateUtil du = Guice.createInjector().getInstance(DateUtil.class);
		Date actual = du.parseWowDate("2009-12-31+01:00");
		Date expected = new SimpleDateFormat("yyyy-MM-dd").parse("2009-12-31");
		assertEquals(expected, actual);
	}

	@Test
	public void shouldCreateDate() throws ParseException {
		DateUtil du = Guice.createInjector().getInstance(DateUtil.class);
		Date actual = du.createDate(2009, 12, 31);
		Date expected = new SimpleDateFormat("yyyy-MM-dd").parse("2009-12-31");
		assertEquals(expected, actual);
	}

}
